{include file="news/header.tpl"}

 {literal}
<script type="text/javascript">
$(document).ready(function() { 
	$("#chk_all").click( 
		 function(){ 
			if(this.checked){ 
			 $("input[name='chk_list']").attr('checked', true) 
			 }else{ 
			$("input[name='chk_list']").attr('checked', false) 
			} 
			} 
			);

     $("#cate").change(function(){
  	   var a=$(this).children('option:selected').val();  //弹出select的值
       window.location.href='/factory/c/?mid={/literal}{$module}{literal}&cid='+a;
         });
	  
          });   


    
 

function act(name){

 var arrChk=$("input[name='chk_list']:checked");
	 var ids='';
	 var cid=$("input[name='category']").val(); 

if(name=='search'){
window.location.href='/factory/c/?type=manage&cid='+cid;         
return false;
}

 
 var flag=confirm('确认操作?');
 
 if(flag==false){
     return false;
 }

 $(arrChk).each(function(){
	     ids=ids+','+this.value;                        
	  }); 

	 $.post("/factory/edit",{ids:ids,cid:cid,type:name},function(data){
         alert(data.error);  
         window.location.href='/factory/c/?type=manage';
	 },"json");


}




function recyle(id){
      var  ids=","+id;
    if(confirm("确认删除")==true){
       
   	 $.post("/factory/edit/",{ids:ids,cid:1067,type:"move"},function(data){
       // alert("删除成功");
         $("#"+id).fadeOut();
	 },"json");
    }else{
      return false;
    }
}    
  
       
function sort(id){
var s=$("#sort"+id).val();

$.post("/factory/s",{sort:s,id:id},function(data){
 alert(data);  
});
}    	       

</script>

{/literal}

</head>

<!-- 头部// -->
{include file="news/top.tpl"}


{include file="news/nav.tpl"}
	<!-- start: Content -->
			<div id="content" class="span10">
			
						
			<div class="row-fluid">


<div class="well"><!-- Default panel contents -->



<div class="box-content">


<form class="form-inline" method="post" action="/factory/search">

 <input type="checkbox" name="chk_all"
	id="chk_all" />{$lang['SELECTALL']} {$category}

<!-- 
<input type=button name=copy class="btn btn-primary" value="{$lang['SEARCH']}" onclick="act('search');">
	
	 <input type=button name=copy
	class="btn btn-primary" value="{$lang['COPY']}" onclick="act('copy');"> <input
	type=button name=move class="btn btn-primary" value="{$lang['MOVE']}"
	onclick="act('move');">
 -->
<select name="key" class="span1" >
	<option value="title">{$lang['TITLE']}</option>
	<option value="id">{$lang['ID']}</option>
</select>

	
	<input class="control" name="value"
	type="text">
<button class="btn btn-primary" type="submit"><i class="icon-search"></i></button>

<a href="/factory/c/?&mid=1&cid=1067" >
<i class="icon-trash "></i>{$lang['RECYCLE']} 
</a>{if $currentcid==1067}| <a href="/factory/clean">清空 {$lang['RECYCLE']} </a>{/if}
		 <span class="pull-right text-info">{$totalnum}</span>
	
</form>




<table class="table  table-striped table-hover">
	<tr>
		<th class="col-md-1"></th>
		<th class="col-md-1">{$lang['ID']}</th>
		<th class="col-md-2"></th>
		<th class="col-md-5">{$lang['TITLE']}</th>
		<th class="col-md-2"></th>
		<th class="col-md-1"></th>
					<th class="col-md-1">{$lang['VIEWS']}</th>
		<th class="col-md-1">{$lang['SORT']}</th>
		<th class="col-md-1">{$lang['STATUS']}</th>
	   <th class="col-md-1"></th>
		
	</tr>

	{section name=l loop=$news }
	<tr id="{$news[l].id}" class="even">
		<td class="center"><label class="checkbox"> <input type=checkbox name="chk_list"
			value="{$news[l].id}"></label></td>
			<td class="center">{$news[l].id}</td>
		<td class="center"><a href="/factory/c/?mid={$news[l].mid}&cid={$news[l].cid}">{$news[l].category_name|cntruncate:"6"}</a></td>
		<td class="center"><a href="/factory/v/?mid={$news[l].mid}&pre={$currentcid}&id={$news[l].id}&p={$num.current}" target="_blank"><i class="icon-edit"></i></a>&nbsp;&nbsp;{$news[l].title}</a>

		 </td>
		<td class="center"><small>{$news[l].date|wtime}</small></td>
		<td class="center">{$news[l].author}</td>
		<td>+{$news[l].views}</td>
		<td class="center"> <input type="text"
			id="sort{$news[l].id}" class="pull-left" style="width: 50px"
			value="{$news[l].sort}" onblur="sort({$news[l].id})"> <!--<a href="/news/remove/?id={$news[l].id}">删除</a>-->
		</td>
		<td class="center">{if $news[l].status==0}{$lang['SHOW']}{else}{$lang['HIDDEN']}{/if}</td>
		<td>
		<a href="javascript:void(0)"  title="{$lang['RECYCLE']}"
			onclick="recyle({$news[l].id})" ><i class="icon-trash "></i></a>
			&nbsp;&nbsp;
		<a
			href='{if $news[l].html!=""}{$news[l].html}{else}/news/v/?id={$news[l].id}{/if}'
			target="_blank" title="{$lang['PREVIOUS']}"><i class="icon-globe"></i></a>
		</td>

	</tr>
	{/section}

</table>

<div class="pagination pagination-centered">
<ul id="pager"></ul></div>

</div>




</div>


{literal}
<script type='text/javascript'>
var options = {
currentPage: {/literal}{$num.current}{literal},
totalPages: {/literal}{$num.page}{literal},
numberOfPages:5,
bootstrapMajorVersion:3,
pageUrl: function(type, page, current){
    return "/factory/c/?type=manage&cid={/literal}{$currentcid}&mid={$module}{literal}&p="+page;
}
}
$('#pager').bootstrapPaginator(options);
</script>
{/literal}
{include file="news/footer.tpl"}